This document describes the Sitecore RSS Module from the developer’s point of view. Please refer to the end user documentation for installation instructions and general description.
1. Feed Types
There are three types of feeds in the module: regular, static and embedded.
Regular feeds are of the simplest kind of the three
available. Regular feeds are represented by the Sitecore items based on the
RSS Feed template (/templates/RSS Module/RSS Feed).
RSS Feed template has the RSS Feed Layout as its default layout, so when
user accesses the RSS Feed item, layout code-beside is invoked - the feed
is created, populated and written to the Response.
Embedded feeds rely on the RSS device and the custom processor in the HttpRequestBegin pipeline. The processor is invoked right before the ExecuteRequest: if the RSS device matches the request, but the RSS Feed layout isn’t set, it explicitly sets the RSS Feed layout. This saves user from having to add the RSS Feed layout to the RSS device on each layout he wants to syndicate. Then the RSS layout is invoked and the feed is written to the response as usual.
Embedded and Regular feeds rely on Sitecore cache, and do not introduce their own cache for the sake of module’s simplicity.
Static feeds differ from the previous two ones: the feed
is stored on disk and refreshed each time when the ‘publish’ operation is
performed as the module is subscribed to the ‘publish:end’ event. This
offers a lot better performance, but there is one major drawback: it is
impossible to automatically render the full link to the RSS feed or feed
item, because you don’t know which site (the Sitecore solution can have
many) will be serving this item to the reader.
Another downside is that static feeds cannot be secured on per-user basis.
It is not necessary to put all static feeds under some specific folder: link database is used to find all items using the RSS Feed template in the publish target database. Hence it is necessary that the link database is kept in shape.
2. Performance Notes
Static feeds are the best choice performance-wise, since there are some performance concerns if you choose to use regular or embedded feeds.
RSS Module relies on Sitecore cache and doesn’t introduce its own caching
mechanism (apart from static feeds) for the sake of simplicity. This means
that the feed is generated each time the request comes in. Please consider
this when creating feeds – some content trees can be really big.
If you use the module under a heavy stress and need dynamic feeds you should implement a caching mechanism and flush the cache on incremental or full publishing. (Handling the single item publish would be a bit trickier).
DoGetItems() method of the Feed class uses the Sitecore query to select all items that meet the maximum age limitation. This is done to increase the performance, so having a maximum age setting set in module settings should help. However the query itself might become slow on extremely large databases – you might choose to provide an alternative implementation of this method.
Please also note how the Controller class gets the all items based on ‘RSS Feed’ template from the database using the link database. This allows feeds to be placed anywhere in the content tree and provides pretty good performance.
3. Setting Inheritance
Setting inheritance allows feeds to inherit some relevant settings from their parent feeds or from the global settings. In pseudo-code this will look like this:
if(this[SettingName] Is Not Empty)
return this[SettingName];
else if (ParentItem is RSSFeed)
return ParentItem[Setting];
else if (GlobalSettings != null)
return GlobalSettings[SettingName];
return this[SettingName];
The ‘global settings’ is an item with a well-known ID, so it can be easily accessed.
This is also the reason why the tristate fields are used instead of the checkboxes: to allow boolean fields to inherit settings.
4. Security Notes
While the static feeds are much faster than the dynamic ones, they cannot be secured on per-user basis, because they are pre-generated in the publishing context and stored as xml files. So basically any items visible from the publishing context will appear in the feed.
Since the regular and embedded feeds are populated in the web site context, they obey the Sitecore extranet security – if the user doesn’t have the permission to access the item, the item will not appear in the feed for this user.
5. Source Code
This document is only meant to provide architectural review: please see the source code for lower-level details. The source code is commented well enough and always stays up to date.